<#assign ctx=request.contextPath>
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>添加配置</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico">
    <link rel="stylesheet" href="${ctx}/static/css/bootstrap.min.css" />
    <link rel="stylesheet" href="${ctx}/static/css/font-awesome.min.css" />
    <link rel="stylesheet" href="${ctx}/static/datacenter/css/font-awesome.min.css" />
    <link href="${ctx}/static/datacenter/css/animate.css" rel="stylesheet">
    <link href="${ctx}/static/datacenter/css/style.css" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <form class="form-horizontal m-t" id="roleForm">
                        <input type="hidden" id="id" name="id" value="${baseParam.id}">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">参数说明</label>
                            <div class="col-sm-8">
                                <input id="name" name="name" class="form-control" type="text" value="${baseParam.name}" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">参数编码：</label>
                            <div class="col-sm-8">
                                <input id="code" name="code" class="form-control" value="${baseParam.code}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">参数值：</label>
                            <div class="col-sm-8">
                                <input id="value" name="value" class="form-control" value="${baseParam.value}">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-8 col-sm-offset-3">
                                <button class="btn btn-primary" type="submit">提交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

</div>
<!-- 全局js -->
    <#include "/common.ftl">
<script type="text/javascript">
    $(document).ready(function () {

        $("#roleForm").validate({
            rules: {
                name: {
                    required: false
                },
                code: {
                    required: false
                },
                value: {
                    required: false
                }
            },
            messages: {},
            submitHandler:function(form){
                $.ajax({
                    type: "POST",
                    dataType: "json",
                    url: "${ctx}/web/config/addBaseParam",
                    data: $(form).serialize(),
                    success: function(msg){
                        layer.msg(msg.message, {time: 2000},function(){
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index);
                        });
                    }
                });
            }
        });
    });
</script>

</body>

</html>
